package com.jwtsecurity.system.controller;


import com.jwtsecurity.system.serivce.impl.JwtService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class JwtAuthController {

    @Autowired
    JwtService service;

    @RequestMapping("/jwtAuthlogin")
    public Map<String,Object> login (@RequestBody Map<String,Object> map){
        return service.login(map);
    }

    @RequestMapping("/refreshtoken")
    public Map<String,Object> refresh(@RequestHeader("${jwt.header}") String token){
        return service.refresh(token);
    }

    @RequestMapping("/holle")
    public Map<String,Object> holle (){
        Map<String,Object> res = new HashMap<>();
        res.put("ok","123");
        return res;
    }


}
